home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
sputils.zip
/
DEMO1.BAT
< prev
next >
Wrap
DOS Batch File
|
1991-01-08
|
16KB
|
462 lines
echo off
rem ------------------------------------------------------
rem batch file 1
rem
rem (C) speter software, January 1991.
rem ------------------------------------------------------
rem this batch file will:
rem 1 demonstrate the function of the batch utilities;
rem 2 show the documentation for the utilities;
rem 3 show demonstrations of the utilities.
rem ------------------------------------------------------
rem This section sets up the DOS environment variables used in this
rem batch file.
rem set (ANSI) text colour to white on blue
echo H
1H
hasmouse
if errorlevel 1 set _um=T
rem suppress text cursor if mouse is available:
if %_um%==T set _t=/t
rem chose which "more" command to use:
if %_um%==T set _m=mormouse /c
if not %_um%==T set _m=more
rem choose which prompt to use:
if %_um%==T set _p=/t press a button to continue
if not %_um%==T set _p=press any key to continue
rem --------------------------------------------------
rem page 0 (general intro)
rem --------------------------------------------------
copyrect demo-p0.scr 0 1 1
askmouse 51 23 52 23 Xx* 51 23 /m
if errorlevel 203 goto ok
if errorlevel 202 goto end
rem --------------------------------------------------
rem page 1 (provides short descriptions of utilities)
rem --------------------------------------------------
copyrect demo-p1.scr 0 1 1
copyrect 0 37 2 80 25 1 37 2
:in-p1
askmouse 26 3 36 22 q 26 11 %_t%
rem ---- mouse (or text cursor) entry
if errorlevel 122 goto end
if errorlevel 121 goto demos
if errorlevel 120 goto docs
if errorlevel 119 goto in-p1
if errorlevel 118 BoxText /s1 s 37 17 113 Removes TABs from an file, replacing!them with SPACEs, writes the result to!a file.
if errorlevel 117 BoxText /s1 s 37 16 113 Deletes a word (or series of) from a!file, the result is written to another!file.
if errorlevel 116 BoxText /s1 s 37 15 113 Deletes any characters within a spec. !column range, writes the result to!a file.
if errorlevel 115 BoxText /s1 s 37 14 113 Displays all (255) text attributes - !foreground, background colour &!blinking.
if errorlevel 114 BoxText /s1 s 37 13 113 Reports the length of the longest line!of a specified text file & the no.!of lines.
if errorlevel 113 BoxText /s1 s 37 12 113 Show the Disk Usage - total bytes used!in the spec. directory and sub-dirs.
if errorlevel 112 BoxText /s1 s 37 11 113 Simple decimal to binary (and Hex) !converter (numbers less than 65768).
if errorlevel 111 goto in-p1
if errorlevel 110 BoxText /s1 s 37 9 113 Similar to DOS "more" command, except !uses mouse-button press INSTEAD of a!keypress.
if errorlevel 109 BoxText /s1 s 37 8 113 Used in batch files to determine mouse!availability, sets the DOS errorlevel.
if errorlevel 108 BoxText /s1 s 37 7 113 Display a message using a specified !text attribute.
if errorlevel 107 BoxText /s1 s 37 6 113 Copy part (or all) of a text screen!to/from disk & other (nonvisible) text!screens.
if errorlevel 106 BoxText /s1 s 37 5 113 Wait for a mouse-button or key press;!optionally display a message before !waiting.
if errorlevel 105 BoxText /s1 s 37 4 113 Display a message inside a box using a!specified text attribute.!* * used here * *
if errorlevel 104 BoxText /s1 s 37 3 113 Display a box using a specified text !attribute, by default clears inside!the box.
if errorlevel 103 BoxText /s1 s 37 2 113 For selections in batch files, uses a !mouse, cursor keys &/or specified!characters.
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 * 75 24 %_t%
copyrect 1 37 2 80 25 0 37 2
goto in-p1
rem --------------------------------------------------
rem page 2 (displays full documentation on utilities)
rem --------------------------------------------------
:docs
copyrect 0 1 1 80 25 1 1 1 (copy display page 0 to display page 1)
copyrect demo-p2.scr 2 1 1 (read 2nd page from file)
:in-p2
copyrect 2 1 1 80 25 0 1 1 (copy 2nd page to display page 0)
askmouse 26 3 34 20 q 26 11 %_t%
rem ---- mouse (or text cursor) entry
if errorlevel 120 goto P2return
if errorlevel 119 goto in-p2
if errorlevel 118 %_m% < striptab.doc
if errorlevel 117 %_m% < stripstr.doc
if errorlevel 116 %_m% < stripcol.doc
if errorlevel 115 %_m% < showattr.doc
if errorlevel 114 %_m% < linelen.doc
if errorlevel 113 %_m% < du.doc
if errorlevel 112 %_m% < binary.doc
if errorlevel 111 goto in-p2
if errorlevel 110 %_m% < mormouse.doc
if errorlevel 109 %_m% < hasmouse.doc
if errorlevel 108 %_m% < dtext.doc
if errorlevel 107 %_m% < copyrect.doc
if errorlevel 106 %_m% < butnpres.doc
if errorlevel 105 %_m% < boxtext.doc
if errorlevel 104 %_m% < box.doc
if errorlevel 103 %_m% < askmouse.doc
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 * 75 24 %_t%
goto in-p2
:P2return
copyrect 2 1 1 30 1 1 1 1 ( rewrite portion that gets cleared by "cls" )
copyrect 1 1 1 80 25 0 1 1 ( restore page 1 to display page 0 )
goto in-p1
rem --------------------------------------------------
rem page 3 (gives demonstrations of the utilities)
rem --------------------------------------------------
:demos
copyrect 0 1 1 80 25 1 1 1 (copy display page 0 to display page 1)
copyrect demo-p3.scr 3 1 1 (read 3rd page from file)
:in-p3
copyrect 3 1 1 80 25 0 1 1 (copy 3rd page to display page 0)
askmouse 26 3 34 20 q 26 11 %_t%
rem ---- mouse (or text cursor) entry
if errorlevel 120 goto P3return
if errorlevel 119 goto in-p3
if errorlevel 118 goto striptab
if errorlevel 117 goto stripstr
if errorlevel 116 goto stripcol
if errorlevel 115 goto showattr
if errorlevel 114 goto linelen
if errorlevel 113 goto du
if errorlevel 112 goto binary
if errorlevel 111 goto in-p3
if errorlevel 110 goto mormouse
if errorlevel 109 goto hasmouse
if errorlevel 108 goto dtext
if errorlevel 107 goto copyrect
if errorlevel 106 goto butnpres
if errorlevel 105 goto boxtext
if errorlevel 104 goto box
if errorlevel 103 goto askmouse
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 * 75 24 %_t%
goto in-p3
:P3return
copyrect 3 1 1 30 1 1 1 1 ( rewrite portion that gets cleared by "cls" )
copyrect 1 1 1 80 25 0 1 1 ( restore page 1 to display page 0 )
goto in-p1
rem --------------------------------------------------------
:striptab
cls
echo STRIP-TABs
echo
echo This demonstration will strip the tab characters from a file called TABS.TXT
echo (supplied with the utilities); the resulting text will then be displayed on
echo the screen.
echo
echo The command line used will be:
echo
echo STRIPTAB tabs.txt con
echo
butnpres %_p%
echo
STRIPTAB tabs.txt con
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 * 75 24 %_t%
goto in-p3
rem --------------------------------------------------------
:stripstr
cls
echo STRIP-STRING
echo
echo This demonstration will strip the string "efghijk" from a file called
echo LETTERS.TXT (supplied with the utilities); the resulting text will then be
echo displayed on the screen.
echo
echo LETTERS.TXT contains the string "abcdefghijklmnopqrstuvwxyz" 5 times.
echo
echo The command line used will be:
echo
echo STRIPSTR /sefghijk letters.txt con
echo
butnpres %_p%
echo
STRIPSTR /sefghijk letters.txt con
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 * 75 24 %_t%
goto in-p3
rem --------------------------------------------------------
:stripcol
cls
echo
echo STRIP COLUMN RANGE
echo
echo This demonstration will strip all the characters between column 10 and column
echo 20 from the file LETTERS.TXT (supplied with the utilities); the resulting text
echo will then be displayed on the screen.
echo
echo LETTERS.TXT contains the string "abcdefghijklmnopqrstuvwxyz" 5 times.
echo 10*---------*20
echo
echo the resulting text should be "abcdefghiuvwxyz" 5 times.
echo
echo The command line used will be:
echo
echo STRIPCOL 10 20 letters.txt con
echo
butnpres %_p%
echo
STRIPCOL 10 20 letters.txt con
BoxText /s1 s 73 23 103 OK
askmouse 75 24 78 24 *